#include <bits/stdc++.h>
using namespace std;
set<pair<int, int>> s;
bool f[200000001];
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  while (q--) {
    int op;
    cin >> op;
    if (op == 1) {
      int a, b;
      cin >> a >> b;
      s.insert({a, b});
    } else if (op == 2) {
      int x;
      cin >> x;
      f[x] = 1;
    } else if (op == 3) {
      int x, y;
      cin >> x >> y;
      if (f[x] || s.find({x, y}) != s.end()) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
  }
  return 0;
}